<template>
	<view class="menu-list">
		<view class="list-cell list-cell-arrow" v-for="item in list" :key="item.id"  @tap="openForm3(item)">
			<view class="title-container">
				<text class="title">供应商名称：{{item.supplierName}}</text>
			</view>
			<view class="top10">
				<!-- <view class="second-title"><text class="sub-title">{{ item.state }} </text></view> -->
				<view class="second-title col666">申请入库时间：<uni-dateformat style="margin: 0 auto;" :date="item.createTime"></uni-dateformat></view>
			</view>
			<view class="top10">
				<!-- <view class="second-title"><text class="sub-title">{{ item.state }} </text></view> -->
				<view class="second-title col666">审核状态：{{item.status}}</uni-dateformat></view>
			</view>
		</view>
		<uni-load-more :status="loadStatus" :content-text="{ contentdown: '上拉加载更多' }" @tap="loadMore" />
	</view>
</template>

<script>

	import * as purchaseinorderApi from '@/api/purchaseinorder/index.js';
	

	export default {
		name: "verify",
		components: {

		},
		data() {
			return {
				loadStatus: '',
				// 遮罩层
				loading: true,
				// 导出遮罩层
				exportLoading: false,
				// 显示搜索条件
				showSearch: true,
				// 总条数
				total: 0,
				// 随手拍列表
				list: [],
				// 是否展开，默认全部展开
				isExpandAll: true,
				// 重新渲染表格状态
				refreshTable: true,
				// 选中行
				currentRow: {},
				// 查询参数
				queryParams: {
					pageNo: 1,
					pageSize: 10,
					location: null,
					creator: null,
					createTime: [],
					sort: null,
					state: null,
					isrelease: null,
					deptId: null,
					deptName: null,
					deptCode: '',
					ruleType: '',
				},
			};
		},
		created() {
			this.getList();
		},
		onShow() {
			this.getList();
		},
		onLoad() {
			// this.getUser()

		},

		methods: {
			//获取登录用户信息
			// getUser() {
			// 	getUserProfile().then(response => {
			// 		this.getList(response.data.dept.deptCode);
			// 	})
			// }, 

			// 标题显示超过字数用...代替
			// truncateText(text, maxLength) {
			// 	if (text.length > maxLength) {
			// 		return text.substring(0, maxLength) + '...';
			// 	}
			// 	return text;
			// },

			/** 查询列表 */
			async getList() {
				try {
					this.loadStatus = 'loading';
					// this.queryParams.deptCode = deptCode
					const res = await purchaseinorderApi.getPurPurchaseOrderPageadd(this.queryParams);
					console.log(res)
					if (this.queryParams.pageNo === 1) {
						this.list = res.data.list
					} else {
						this.list = [...this.list, ...res.data.list];
					}
					this.total = res.data.total;
					if (this.list.length >= res.data.total) {
						this.loadStatus = 'nomore';
					} else {
						this.loadStatus = 'more';
					}
					this.list.forEach((item) => {
						if (item.status === 0) {
							item.status = '待提交'
						} else if (item.status === 1) {
							item.status = '待审核'
						} else if (item.status === 2) {
							item.status = '被退回'
						}else if (item.status === 3) {
							item.status = '已通过'
						}
					})
				} finally {
					this.loading = false;
				}
			},

			// 加载更多
			loadMore() {
				if (this.loadStatus === 'nomore') {
					return;
				}
				this.queryParams.pageNo++;
				this.getList()
			},
			onReachBottom() {
				this.loadMore();
			},
		}
	};
</script>
<style lang="scss" scoped>
	.list-item {
		background-color: #FFFFFF;
		margin: 30rpx;
		display: flex;
		flex-direction: row;
		// justify-content: center;
		// align-items: center;
		padding: 10rpx;
		border-radius: 8rpx;
		color: #303133;
		font-size: 32rpx;

		.avatar {
			width: 52rpx;
			height: 52rpx;
			border-radius: 50%;
		}

		.nickname {
			font-size: 26rpx;
			font-weight: 500;
			color: #999999;
		}

		.create-time {
			font-size: 24rpx;
			font-weight: 500;
			color: #c4c4c4;
		}

		.content-title {
			font-size: 26rpx;
			font-weight: 400;
			color: #666666;
			line-height: 42rpx;
		}

		.content-img {
			width: 174rpx;
			height: 174rpx;
		}

		.cicon-info-o {
			font-size: 26rpx;
			color: #c4c4c4;
		}

		.foot-title {
			font-size: 24rpx;
			font-weight: 500;
			color: #999999;
		}
	}

	.btn-box {
		width: 100%;
		height: 120rpx;
		background: #fff;
		border-top: 2rpx solid #eee;
	}

	.tab-btn {
		width: 130rpx;
		height: 62rpx;
		background: #eeeeee;
		border-radius: 31rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #999999;
		border: 1px solid #e5e5e5;
		margin-right: 10rpx;
	}

	.vertical-button {
		color: #2499f2;
		margin-right: 10px;
		font-size: 14px;
		line-height: 20px;
		padding: 0 10px;
		height: 24px;
		box-sizing: border-box;
		border: none;
		border-radius: 4px;
		margin-left: 5px;
		vertical-align: middle;
		width: 50px;
		hight: 5px;
		margin-top: 7rpx;
		padding: 7rpx 0;
		background-color: white;
	}
</style>